package com.sqllog.admin.framework.config;

import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.context.annotation.Bean;

/**
 * TODO
 *
 * @author chennengcheng
 * @date 2022-02-10 12:30
 * @remark
 */
public class BaseConfig {

    /**
     * 注入connecter
     *
     * @param gracefulShutDown
     * @return
     */
    @Bean
    public ServletWebServerFactory servletContainer(GracefulShutDown gracefulShutDown) {
        TomcatServletWebServerFactory tomcatServletWebServerFactory = new TomcatServletWebServerFactory();
        tomcatServletWebServerFactory.addConnectorCustomizers(gracefulShutDown);
        return tomcatServletWebServerFactory;
    }

    @Bean
    public GracefulShutDown gracefulShutDown() {
        return new GracefulShutDown();

    }
}